package com.ep.thirdPlatformProject.system.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ep.thirdPlatformProject.system.entity.DhgEmployeeTest;
import com.ep.thirdPlatformProject.system.entity.EmpInfo;
import com.ep.thirdPlatformProject.system.entity.dto.EmployeeTestDTO;
import com.ep.thirdPlatformProject.system.mapper.DhgEmployeeTestMapper;


import com.ep.thirdPlatformProject.system.service.DhgEmployeeTestService;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@RequiredArgsConstructor
@Service
@DS("sqlserver")
public class DhgEmployeeTestServiceImpl extends ServiceImpl<DhgEmployeeTestMapper, DhgEmployeeTest> implements DhgEmployeeTestService {

    private final DhgEmployeeTestMapper employeeTestMapper;

    public void doSomeThingJoin() {
        MPJLambdaWrapper<DhgEmployeeTest> queryWrapper = new MPJLambdaWrapper<DhgEmployeeTest>()
                .selectAll(DhgEmployeeTest.class)
                .select(EmpInfo::getMaritalStatus, EmpInfo::getOriginId)
                .leftJoin(EmpInfo.class, EmpInfo::getEmpNo, DhgEmployeeTest::getEmpNo);

        List<EmployeeTestDTO> list = employeeTestMapper.selectJoinList(EmployeeTestDTO.class, queryWrapper);
        System.out.println("list = " + list);
    }


}
